import 'package:flutter/material.dart';
import 'package:flutter_cwhisky/common/style/icons.dart';
import 'package:flutter_cwhisky/component/business/memer_good.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../../bean/mall_home_entity.dart';
import '../../common/style/dimens.dart';
import '../image_view.dart';
import '../text_view.dart';

class HomeMemberGood extends StatelessWidget {
  final MallHomeDataMemberArea? memberArea;

  const HomeMemberGood({Key? key, required this.memberArea}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return memberArea == null
        ? const SizedBox()
        : AspectRatio(
            aspectRatio: 345 / 203,
            child: Container(
                height: 203.r,
                decoration:
                    const BoxDecoration(image: DecorationImage(image: AssetImage('assets/images/bg_home_member.png'))),
                margin: EdgeInsets.only(top: 12.r, left: Dimens.horizontalMargin, right: Dimens.horizontalMargin),
                child: Column(
                  children: [
                    Row(
                      children: [
                        Expanded(
                            child: Container(
                          padding: EdgeInsets.only(top: 14.r, left: 10.r),
                          child: Row(
                            children: [
                              ImageView(
                                url: 'assets/images/icon_home_member_title.png',
                                height: 21.r,
                              ),
                              Padding(
                                padding: EdgeInsets.only(left: 4.r),
                                child: TextView(
                                  text: '会员专区',
                                  fontSize: 16.sp,
                                  fontColor: const Color(0xff7C3F04),
                                  fontWeight: FontWeight.w500,
                                ),
                              ),
                              Padding(
                                padding: EdgeInsets.only(left: 4.r),
                                child: TextView(
                                  text: '尊享优惠',
                                  fontSize: 12.sp,
                                  fontColor: const Color(0xff8D6238),
                                ),
                              ),
                              Padding(
                                padding: EdgeInsets.only(left: 4.r),
                                child: TextView(
                                  text: '|',
                                  fontSize: 12.sp,
                                  fontColor: const Color(0xff8D6238),
                                ),
                              ),
                              Padding(
                                padding: EdgeInsets.only(left: 4.r),
                                child: TextView(
                                  text: '“酒”等你来',
                                  fontSize: 12.sp,
                                  fontColor: const Color(0xff8D6238),
                                ),
                              ),
                            ],
                          ),
                        )),
                        Padding(
                          padding: EdgeInsets.only(right: 12.r, top: 10.r),
                          child: Row(
                            children: [
                              TextView(
                                text: '更多',
                                fontSize: 10.sp,
                                fontColor: const Color(0xffFFE0C2),
                              ),
                              const Icon(
                                AppIcons.icArrowRight,
                                size: 6,
                                color: Color(0xffFFE0C2),
                              )
                            ],
                          ),
                        )
                      ],
                    ),
                    Expanded(

                        child: Container(
                          margin: EdgeInsets.only(left: 7.r,right: 1.r),
                      child: ListView.builder(
                          scrollDirection: Axis.horizontal,
                          itemCount: memberArea!.goods!.length,
                          itemBuilder: (context, index) => MemberGood(good: memberArea!.goods![index])),
                    ))
                  ],
                )),
          );
    ;
  }
}
